var app=getApp()
Page({

  data: {
    name:'',
    sort:0
  },

  onLoad: function (options) {

  },
 
  onShow: function () {

  },
  bindName:function(e){
    this.data.name = e.detail.value
  },
  bindSort:function(e){
    this.data.sort = e.detail.value
  },
  onSubmit:function(){
    if (!this.data.sort || !this.data.name){
      app.showToastMsg("请输入相应的内容")
      return
    }
    var that = this
    app.request.reqLoading("addSort", {
      name: this.data.name,
      sort: this.data.sort
    }, function (res) {
      console.log("====" + JSON.stringify(res))
      if (res.code == 0) {
        that.setData({
          name:'',
          sort:0
        })
      } else {
        app.showToastMsg(res.msg)
      }
    })
  }
})